using System.Collections;
using System.Collections.Generic;
using Holoville.HOTween;
using UnityEngine;

public class TestAnim : MonoBehaviour
{
	public Transform dest;

	public GameObject sprite;

	public List<GameObject> spritest = new List<GameObject>();

	public List<GameObject> spritest2 = new List<GameObject>();

	public float time = 2f;

	public void Start()
	{
		HOTween.Init();
	}

	public void StartAnim()
	{
		StartCoroutine(ololo());
	}

	private IEnumerator ololo()
	{
		for (int i = 0; i < spritest.Count; i++)
		{
			StartCoroutine(SingleAnimTop(i));
			StartCoroutine(SingleAnim(i));
			yield return new WaitForSeconds(0.25f);
		}
	}

	private IEnumerator SingleAnimTop(int i)
	{
		HOTween.To(spritest[i].transform, time, new TweenParms().Prop("position", dest.position).Ease(EaseType.EaseOutExpo));
		HOTween.To(spritest[i].transform, time / 4f, new TweenParms().Prop("localScale", Vector3.one).Ease(EaseType.EaseOutExpo));
		yield return new WaitForSeconds(time / 2f);
		HOTween.To(spritest[i].transform, time / 4f, new TweenParms().Prop("localScale", Vector3.zero).Ease(EaseType.EaseOutExpo));
	}

	private IEnumerator SingleAnim(int i)
	{
		Vector3 mod = ((!((double)Random.value > 0.5)) ? (Vector3.down * 10f) : (Vector3.up * 10f));
		HOTween.To(spritest2[i].transform, time / 10f, new TweenParms().Prop("localPosition", spritest2[i].transform.localPosition + mod).Ease(EaseType.Linear).Loops(-1, LoopType.Yoyo));
		yield return null;
	}
}
